package com.auto.sns.core.action;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.auto.sns.core.domain.SnsCoreHyperlink;
import com.auto.sns.core.domain.SnsCoreReplyInfo;
import com.auto.sns.core.service.SnsCoreServiceFactory;
import com.auto.sns.core.util.CoreUtil;
import com.auto.tools.AutoUtils;
import com.system.common.BaseAction;
import com.system.util.JsonUtil;

/**
 * 消息中心
 * @author wushihua
 *
 */
public class SnsCoreMessageCenterAction extends BaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = -366577558747688905L;

	/**
	 * 添加话题
	 * @throws Exception 
	 */
	public void saveOrUpdateSnsCoreMessage() throws Exception{
		String data = getRequest().getParameter("data");
//		SnsCoreMessage snsCoreMessage = (SnsCoreMessage)JsonUtil.jsonToBean(data, SnsCoreMessage.class);
//		
//		snsCoreMessage.setPubDate(new Date());
//		snsCoreMessage.setPubUserCode(AutoUtils.getUserCode());
//		snsCoreMessage.setPubUserName(AutoUtils.getUserCode());
		
//		SnsCoreServiceFactory.snsCoreInfoService.saveOrUpdateSnsCoreMessage(snsCoreMessage);
	}
	
	public String messageCenterInfo(){
		
		//任务个数
		String roleCount = CoreUtil.getRoleCount();
		
		//消息个数
		String messageCount = CoreUtil.getNewsCount();
		
		List messageList = new ArrayList();
		SnsCoreReplyInfo snsCoreReplyInfo = new SnsCoreReplyInfo();
		
		messageList.add(snsCoreReplyInfo);
		
		this.getRequest().setAttribute("roleCount", roleCount);
		this.getRequest().setAttribute("messageCount", messageCount);
		
		this.getRequest().setAttribute("messageList", messageList);
		
		return "success";
	}
}
